//
// Created by vista on 2017/12/17.
//

#ifndef P_P17_H
#define P_P17_H

#include <vector>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iostream>
#include <stack>
#include <set>
using namespace std;

class Solution {
public:
    const string dict[10] = {" ","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};

    void append(vector<string>& vector1, string pre, string digits){
        int index = digits[0] - '0';
        if(digits.length() == 1){
            for (char i : dict[index]) {
                vector1.emplace_back(pre+ i);
            }
        }else
        {
            for (char i : dict[index]) {
                append(vector1,pre + i,digits.substr(1));
            }

        }
    }

    vector<string> letterCombinations(string digits) {
        vector<string> all;
        if(digits.length() == 0){
            return all;
        }

        append(all,"",digits);

        return all;
    }
};

#endif //P_P17_H
